$(document).ready(function(){
    // 在键盘按下并释放及提交后验证提交表单，根据name
    $(".infoForm").validate({
        rules: {
            n_phonenumber: {
                required: true,
                rangelength: [11,11],
                digits: true
            },
            n_gender: {
                required: true,
                rangelength: [1,1]
            },
            n_e_mail: {
                required: true,
                email: true
            },

            n_nickname: {
                required: true,
                minlength: 2
            },
            n_occupation: {
                required: true,
                minlength: 2
            },
            n_preference: "required",
            n_birthday: "required"
        },
        messages: {
            n_phonenumber: {
                required: "请输入手机号",
                rangelength: "手机号必须为11位",
                digits: "手机号必须为数字"
            },
            n_e_mail: {
                required: "请输入电子邮件",
                email: "请输入有效的邮箱地址"
            },
            n_gender: {
                required: "请输入性别",
                rangelength: "请输入'男'或'女'"
            },
            n_nickname: {
                required: "请输入昵称",
                minlength: "昵称长度不能小于 2 位"
            },
            n_occupation: {
                required: "请输入职业",
                minlength: "职业长度不能小于 2 位"
            },
            n_preference: "请输入爱好",
            n_birthdate: "请输入出生日期"
        }
    })
});